//
//  GoodsServiceTableViewCell.swift
//  ZNZXSuperMarket
//
//  Created by 四川中农 on 2018/7/30.
//  Copyright © 2018年 四川中农. All rights reserved.
//

import UIKit

class GoodsServiceTableViewCell: UITableViewCell {

    @IBOutlet weak var viewLine1: UIView!
    @IBOutlet weak var viewLine2: UIView!
    
    @IBOutlet weak var distributionService: UILabel! // 配送服务
    @IBOutlet weak var afterSaleLabel: UILabel! // 售后服务
    @IBOutlet weak var onLinePayType: UILabel!
    @IBOutlet weak var payType: UILabel!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        self.addDottedLine()
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    func reload(withModel model:SiteGoodsModel){
        self.distributionService.text = model.distributionDesc
        self.afterSaleLabel.text = model.aftersaleDesc
        self.onLinePayType.text = "在线支付：" + model.payDesc
        self.payType.text = "货到付款：" + model.payDescTwo
    }
    
    func addDottedLine(){
        let shapeLayer = CAShapeLayer()
        shapeLayer.bounds = CGRect.init(x: 0, y: 0, width: UIScreen.ScreenWidth - 24, height: 1) //
        shapeLayer.position = CGPoint.init(x: UIScreen.ScreenWidth/2, y: 108)
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = UIColor.init(hexColor: "#eeeeee").cgColor
        shapeLayer.lineWidth = 1
        shapeLayer.lineJoin = kCALineJoinRound
        shapeLayer.lineDashPattern = [3, 1]
        let path = CGMutablePath()
        path.move(to: CGPoint(x: 0, y: 108), transform: .identity)
        path.addLine(to: CGPoint(x: UIScreen.ScreenWidth - 60, y: 108), transform: .identity)
        shapeLayer.path = path
        self.viewLine1.layer.addSublayer(shapeLayer)
        self.viewLine2.layer.addSublayer(shapeLayer)
    }

}
